package com.fulihui.weixinclient.request;

import com.fulihui.weixinclient.http.HttpMethodEnum;

/**
 * 授权页面请求参数封装
 * Created by Willard on 2015/9/9.
 */
public class OAuthWeixinRequest extends WeixinJsonRequest<String> {

    private static final long serialVersionUID = -5367257670435295180L;

    /* 授权后重定向的回调链接地址 */
    private String            redirect_uri;

    /* 返回类型，请填写code */
    private String            response_type    = "code";

    /* 应用授权作用域 */
    private String            scope;

    /* 重定向后会带上state参数 */
    private String            state;

    @Override
    protected void childParam() {
        addParam("redirect_uri", redirect_uri);
        addParam("response_type", response_type);
        addParam("scope", scope);
        addParam("state", state);
    }

    @Override
    public String service() {
        return "https://open.weixin.qq.com/connect/oauth2/authorize";
    }

    @Override
    public String urlEndStr() {
        return "#wechat_redirect";
    }

    @Override
    public String parseResult(String respStr) {
        return respStr;
    }

    @Override
    public HttpMethodEnum httpMethod() {
        return HttpMethodEnum.SSL_GET;
    }

    @Override
    public String requestData() {
        return null;
    }

    public void setRedirect_uri(String redirect_uri) {
        this.redirect_uri = redirect_uri;
    }

    public void setResponse_type(String response_type) {
        this.response_type = response_type;
    }

    public void setScope(String scope) {
        this.scope = scope;
    }

    public void setState(String state) {
        this.state = state;
    }
}
